package com.shujia.flink.tf

import org.apache.flink.api.common.functions.MapFunction
import org.apache.flink.streaming.api.scala._

object Demo1Map {
  def main(args: Array[String]): Unit = {


    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment


    val studentDS: DataStream[String] = env.readTextFile("data/students.txt")


    val mapDS: DataStream[String] = studentDS.map(new MyMapFunction)

    mapDS.print()

    env.execute()


  }

}

class MyMapFunction extends MapFunction[String, String] {
  override def map(value: String): String = {
    value.split(",")(4)
  }
}